<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Forum/classes/PhpFox_ComponentForumJump.class.php, $Author:  $ */



/** Navigation ("Jump to forum") component.
 *
 * @package module.forum
 * @version $Id: PhpFox_ComponentForumJump.class.php 46 2007-12-14 23:12:21Z phpfoxsv $
 *
 */
class PhpFox_Mod_Forum_ComponentForumJump extends BaseComponent
{

    /** Processing method
     */
	function process()
	{
	    $oReq = &App::getRequest();
	    /* @var $oReq Request */
	    switch($oReq->getAction())
        {
            case 'jump_to_forum':
                $iId = $oReq->getInt('id');
                if ($iId)
                    App::gotoUrl('public.forum.topics', array('id'=>$iId));
                else
                    App::gotoUrl('public.forum'); //root of forums
                break;
        }

		$oTpl = &$this->_oModule->getTemplate();
		// $aHash = App::plugin_getForumTopics();

		if ( App::pluginInstalled('vbulletin') )
		{
			$aHash = vbulletin_forum_topics();
		}
		else
		{
			if ( phpfoxCache )
			{
				$aHash = $this->oDatabase->getRows("SELECT forum_id,forum_title FROM ". App::getT('forum') ." ORDER BY forum_title");
			}
			else
			{
		    	$oSrvForum = &$this->_oModule->getService('Forum');
		    	/* @var $oSrvForum PhpFox_Mod_Forum_ServiceForum */

				$aHash = $oSrvForum->getForumHash();
			}
		}

		$oTpl->assign(array(
            'aForumJumpList' => $aHash,
		));
		$srcHtml = $oTpl->fetch('ForumJump.html');
		return $srcHtml;
	}

}
?>